home *** CD-ROM | disk | FTP | other *** search
/ Champak 49 / Volume 49 - JOGO DISK .iso / Games / hungerstrike.swf / scripts / __Packages / actionscript / HungerStrike.as < prev    next >
Encoding:
Text File  |  2007-09-28  |  22.5 KB  |  681 lines

  1. class actionscript.HungerStrike extends MovieClip
  2. {
  3.    var myListener;
  4.    var _musicOn;
  5.    var _sfxOn;
  6.    var gameMask_mc;
  7.    var trail_mc;
  8.    var interface_mc;
  9.    var brain_mc;
  10.    var _lvl;
  11.    var _money;
  12.    var _lives;
  13.    var _enemyValue;
  14.    var _enemyUpdates;
  15.    var _tCounter;
  16.    var _gameTimer;
  17.    var w1_counter;
  18.    var w2_counter;
  19.    var w3_counter;
  20.    var w4_counter;
  21.    var w5_counter;
  22.    var _maxEnemySpeed;
  23.    var _maxEnemyNumber;
  24.    var _maxBossNumber;
  25.    var _maxEnemyEnergy;
  26.    var _maxBossEnergy;
  27.    var _bossMoney;
  28.    var _maxBossMoney;
  29.    var _minEnemyTimeGap;
  30.    var _energyMultiplier;
  31.    var _lastLevel;
  32.    var _maxEnemyValue;
  33.    var _maxLives;
  34.    var _powerBarsVisible;
  35.    var _gamePaused;
  36.    var _keysLocked;
  37.    var _lifeValue;
  38.    var _loopSoundName;
  39.    var _levelMessage;
  40.    var textMessages;
  41.    var enemyEnergy;
  42.    var enemySpeed;
  43.    var enemyNumber;
  44.    var enemyType;
  45.    var enemyTimeGap;
  46.    var enemyValue;
  47.    var range;
  48.    var damage;
  49.    var delay;
  50.    var upgradeCost;
  51.    var wValue;
  52.    var unlockLevel;
  53.    var sdTime;
  54.    var sdMult;
  55.    var _draggingWeapon;
  56.    var _enemyCounter;
  57.    var _enemyKilled;
  58.    var intervalID;
  59.    var _stopped;
  60.    var currentWeapon;
  61.    var finalwd;
  62.    var panel_mc;
  63.    var target_mc;
  64.    var _enemySpeed = 0;
  65.    var _enemyNumber = 0;
  66.    var _enemyType = "";
  67.    var _enemyTimeGap = 0;
  68.    var _enemyEnergy = 0;
  69.    var _loopStarted = false;
  70.    function HungerStrike()
  71.    {
  72.       super();
  73.       com.mosesSupposes.fuse.ZigoEngine.register(com.mosesSupposes.fuse.Fuse);
  74.       this.myListener = new Object();
  75.       Key.addListener(this.myListener);
  76.       this.myListener.onKeyDown = actionscript.Proxy.create(this,this.keyDownFunction);
  77.       this.myListener.onKeyUp = actionscript.Proxy.create(this,this.keyUpFunction);
  78.       this.initWeaponVariables();
  79.       this.initEnemyVariables();
  80.       this.initStartVariables();
  81.       this._musicOn = true;
  82.       this._sfxOn = true;
  83.       this.gameMask_mc = this.attachMovie("Mask","Mask",this.getNextHighestDepth(),{_x:0,_y:0});
  84.       this.trail_mc = this.attachMovie("Trail","Trail",this.getNextHighestDepth());
  85.       this.interface_mc = this.attachMovie("Interface","Interface",this.getNextHighestDepth());
  86.       this.brain_mc = this._parent.attachMovie("Brain","Brain",this._parent.getNextHighestDepth(),{_x:16,_y:-2});
  87.       this.gameMask_mc._visible = false;
  88.       this.startLevel(this._lvl);
  89.       this.startTimer();
  90.       this.pauseGame();
  91.    }
  92.    function initStartVariables()
  93.    {
  94.       this._lvl = 1;
  95.       this._money = 40;
  96.       this._lives = 3;
  97.       this._enemyValue = 1;
  98.       this._enemyUpdates = 0;
  99.       this._tCounter = 0;
  100.       this._gameTimer = 0;
  101.       this.w1_counter = 1;
  102.       this.w2_counter = 1;
  103.       this.w3_counter = 1;
  104.       this.w4_counter = 1;
  105.       this.w5_counter = 1;
  106.       this._maxEnemySpeed = 4;
  107.       this._maxEnemyNumber = 20;
  108.       this._maxBossNumber = 3;
  109.       this._maxEnemyEnergy = 50000;
  110.       this._maxBossEnergy = 250000;
  111.       this._bossMoney = 25;
  112.       this._maxBossMoney = 1000;
  113.       this._minEnemyTimeGap = 600;
  114.       this._energyMultiplier = 5.4;
  115.       this._lastLevel = 48;
  116.       this._maxEnemyValue = 100;
  117.       this._maxLives = 10;
  118.       this._powerBarsVisible = true;
  119.       this._gamePaused = false;
  120.       this._keysLocked = false;
  121.       this._lifeValue = 50;
  122.       this._loopSoundName = "loop1";
  123.       this._levelMessage = "";
  124.       this.textMessages = new Object({_beansDesc:"Minimal damage with a high rate of fire.",_friesDesc:"Medium damage and a high rate of fire. Useless against Ping Pangs",_pepsiDesc:"Minimal damage with a low rate of fire, but good for slowing movement",_wingsDesc:"Maximum damage with a low rate of fire. Useless against Pang Pangs",_burgerDesc:"Maximum damage and a medium rate of fire",_e1Desc:"Immune to the Pepsi Weapon!",_e1Desc2:"Immune to the Pepsi Weapon!",_e2Desc:"Immune to the Fries Weapon!",_e3Desc:"",_e4Desc:"Immune to the Chicken Weapon!",_e5Desc:"",_e6Desc:"Immune to the Pepsi Weapon!",_e6Desc2:"Immune to both the Pepsi and Chicken Weapons!",_weaponOptions:"Press U to upgrade or S to sell.",_weaponOff:"This Weapon is not available yet",_weaponOver:"Click to select this Weapon",_menuOver:"Click to access to the Main Menu",_creditsOver:"Credits left",_levelOver:"Current Level",_livesOver:"Lives left",_timeOver:"Hunger kept at bay for:",_sellOver:"Sell the selected Weapon",_sellOver2:"Select a Tower to sell",_upgradeOver:"Upgrade the selected Weapon",_upgradeOver2:"Select a Weapon to upgrade",_upgradeOver3:"You donΓÇÖt have enough credit to upgrade this Weapon",_levDef:"Are you satisfied yet? Well, let\'s move on to the next level!",_levBoss1:"Boss Level!",_levBoss2:"Double Boss - immune to Pepsi! Upgrade!",_levBoss3:"Triple Boss - immune to Pepsi and Chicken!",_levNewTower:"New Weapon unlocked!",_levImFries:"Ping Pangs - immune to Fries! Upgrade!",_levImPepsi:"Orangupangs - immune to Pepsi! Upgrade!",_levImWings:"Pang Pangs - immune to Chicken! Upgrade!",_wCannotBePlaced:"This Weapon cannot be placed here",_wCanBePlaced:"Click to place the Weapon"});
  125.    }
  126.    function startSound(sName, bLoop)
  127.    {
  128.       this[sName] = new Sound();
  129.       this[sName].attachSound(sName);
  130.       if(bLoop)
  131.       {
  132.          this[sName].start(0,99);
  133.       }
  134.       else
  135.       {
  136.          this[sName].start();
  137.       }
  138.    }
  139.    function stopSound(sName)
  140.    {
  141.       this[sName].stop();
  142.    }
  143.    function setLevelMessage(nLvl)
  144.    {
  145.       switch(nLvl)
  146.       {
  147.          case 3:
  148.             return this.textMessages._levNewTower;
  149.          case 5:
  150.             return this.textMessages._levNewTower;
  151.          case 6:
  152.             return this.textMessages._levBoss1;
  153.          case 8:
  154.             return this.textMessages._levImFries;
  155.          case 11:
  156.             return this.textMessages._levNewTower;
  157.          case 12:
  158.             return this.textMessages._levBoss2;
  159.          case 13:
  160.             return this.textMessages._levImPepsi;
  161.          case 16:
  162.             return this.textMessages._levImWings;
  163.          case 17:
  164.             return this.textMessages._levNewTower;
  165.          case 18:
  166.             return this.textMessages._levBoss3;
  167.          case 19:
  168.             return this.textMessages._levImPepsi;
  169.          case 24:
  170.             return this.textMessages._levBoss3;
  171.          case 30:
  172.             return this.textMessages._levBoss3;
  173.          case 36:
  174.             return this.textMessages._levBoss3;
  175.          default:
  176.             return "empty";
  177.       }
  178.    }
  179.    function initEnemyVariables()
  180.    {
  181.       this.enemyEnergy = new Array(null,30,40,45,50,60,1000,180,160,260,300,360,3000,360,280,400,500,600,6000,900,800,960,1000,1100,8000,1300,1100,1350,1400,1500,10000,3000,2600,3500,3800,4200,30000,5000,5500,6000,6500,7000,50000,8000,10000,12000,13000,16000,200000);
  182.       this.enemySpeed = new Array(null,1.3,1.4,1.6,1.7,1.5,1);
  183.       this.enemyNumber = new Array(null,10,12,14,16,18,1);
  184.       this.enemyType = new Array(null,"Orangupangs","Ping Pangs","Wu-Pang Clan","Pang Pangs","The Big Pang","Skull");
  185.       this.enemyTimeGap = new Array(null,1500,1000,800,800,700,800);
  186.       this.enemyValue = new Array(null,1,1,2,2,2,100);
  187.    }
  188.    function initWeaponVariables()
  189.    {
  190.       this.range = new Object({Beans1:150,Beans2:200,Beans3:250,Fries1:180,Fries2:240,Fries3:280,Pepsi1:150,Pepsi2:200,Pepsi3:250,Wings1:250,Wings2:280,Wings3:320,Burger1:150,Burger2:180,Burger3:220});
  191.       this.damage = new Object({Beans1:4,Beans2:8,Beans3:20,Fries1:40,Fries2:70,Fries3:100,Pepsi1:10,Pepsi2:10,Pepsi3:10,Wings1:400,Wings2:800,Wings3:1200,Burger1:500,Burger2:1000,Burger3:2000});
  192.       this.delay = new Object({Beans1:0.8,Beans2:0.5,Beans3:0.5,Fries1:0.8,Fries2:0.6,Fries3:0.5,Pepsi1:2,Pepsi2:1.7,Pepsi3:1.5,Wings1:1.8,Wings2:1.5,Wings3:1.2,Burger1:1.4,Burger2:1,Burger3:0.6});
  193.       this.upgradeCost = new Object({Beans1:24,Beans2:60,Fries1:60,Fries2:100,Pepsi1:80,Pepsi2:180,Wings1:300,Wings2:800,Burger1:800,Burger2:2000});
  194.       this.wValue = new Object({Beans1:8,Beans2:this.upgradeCost.Beans1,Beans3:this.upgradeCost.Beans2,Fries1:30,Fries2:this.upgradeCost.Fries1,Fries3:this.upgradeCost.Fries2,Pepsi1:40,Pepsi2:this.upgradeCost.Pepsi1,Pepsi3:this.upgradeCost.Pepsi2,Wings1:120,Wings2:this.upgradeCost.Wings1,Wings3:this.upgradeCost.Wings2,Burger1:300,Burger2:this.upgradeCost.Burger1,Burger3:this.upgradeCost.Burger2});
  195.       this.unlockLevel = new Object({Beans:1,Fries:3,Pepsi:5,Wings:11,Burger:17});
  196.       this.sdTime = new Object({Pepsi1:3,Pepsi2:5,Pepsi3:8});
  197.       this.sdMult = new Object({Pepsi1:0.7,Pepsi2:0.6,Pepsi3:0.5});
  198.    }
  199.    function setVariables(nLevel)
  200.    {
  201.       var _loc3_ = nLevel % 6;
  202.       if(_loc3_ == 0)
  203.       {
  204.          _loc3_ = 6;
  205.          while(this._enemyUpdates < Math.floor(nLevel / 6) - 1)
  206.          {
  207.             this.updateEnemyVariables();
  208.          }
  209.       }
  210.       else
  211.       {
  212.          while(this._enemyUpdates < Math.floor(nLevel / 6))
  213.          {
  214.             this.updateEnemyVariables();
  215.          }
  216.       }
  217.       var _loc4_ = this.setLevelMessage(this._lvl);
  218.       if(_loc4_ != "empty")
  219.       {
  220.          this.interface_mc.info2_txt.text = _loc4_;
  221.       }
  222.       else if(this._lvl != 1)
  223.       {
  224.          this.interface_mc.info2_txt.text = this.textMessages._levDef;
  225.       }
  226.       if(nLevel == 13)
  227.       {
  228.          this._lifeValue = 100;
  229.       }
  230.       else if(nLevel == 19)
  231.       {
  232.          this._lifeValue = 200;
  233.       }
  234.       if(nLevel % 6 == 0)
  235.       {
  236.          this.interface_mc.addSubtractMoney(this._bossMoney);
  237.          this._bossMoney *= 2;
  238.          if(this._bossMoney > this._maxBossMoney)
  239.          {
  240.             this._bossMoney = this._maxBossMoney;
  241.          }
  242.       }
  243.       if(nLevel >= this.unlockLevel.Fries && !this.interface_mc.w2._available)
  244.       {
  245.          this.interface_mc.w2._available = true;
  246.       }
  247.       if(nLevel >= this.unlockLevel.Pepsi && !this.interface_mc.w3._available)
  248.       {
  249.          this.interface_mc.w3._available = true;
  250.       }
  251.       if(nLevel >= this.unlockLevel.Wings && !this.interface_mc.w4._available)
  252.       {
  253.          this.interface_mc.w4._available = true;
  254.       }
  255.       if(nLevel >= this.unlockLevel.Burger && !this.interface_mc.w5._available)
  256.       {
  257.          this.interface_mc.w5._available = true;
  258.       }
  259.       this.interface_mc.checkButtons();
  260.       this._draggingWeapon = false;
  261.       this._enemyCounter = 1;
  262.       this._enemyKilled = 0;
  263.       this._enemySpeed = this.enemySpeed[_loc3_];
  264.       this._enemyNumber = this.enemyNumber[_loc3_];
  265.       this._enemyType = this.enemyType[_loc3_];
  266.       this._enemyTimeGap = this.enemyTimeGap[_loc3_];
  267.       this._enemyEnergy = this.enemyEnergy[this._lvl];
  268.       if(this._lvl > 41 && this._lvl < 48)
  269.       {
  270.          this._enemyValue = this.enemyValue[_loc3_] * 2;
  271.       }
  272.       else
  273.       {
  274.          this._enemyValue = this.enemyValue[_loc3_];
  275.       }
  276.       if(nLevel == 48)
  277.       {
  278.          this._enemyNumber = 1;
  279.          this._enemySpeed = 0.6;
  280.          this._enemyTimeGap = 1500;
  281.       }
  282.       this.traceEnemyProperties();
  283.    }
  284.    function traceEnemyProperties()
  285.    {
  286.    }
  287.    function updateEnemyVariables()
  288.    {
  289.       this._enemyUpdates = this._enemyUpdates + 1;
  290.       this.enemyNumber[6] = this.enemyNumber[6] + 1;
  291.       if(this.enemyNumber[6] > this._maxBossNumber)
  292.       {
  293.          this.enemyNumber[6] = this._maxBossNumber;
  294.       }
  295.       var _loc2_ = 1;
  296.       while(_loc2_ <= 5)
  297.       {
  298.          this.enemySpeed[_loc2_] += 0.2;
  299.          if(this.enemySpeed[_loc2_] > this._maxEnemySpeed)
  300.          {
  301.             this.enemySpeed[_loc2_] = this._maxEnemySpeed;
  302.          }
  303.          this.enemyNumber[_loc2_] += 5;
  304.          if(this.enemyNumber[_loc2_] > this._maxEnemyNumber)
  305.          {
  306.             this.enemyNumber[_loc2_] = this._maxEnemyNumber;
  307.          }
  308.          this.enemyValue[_loc2_] += 2;
  309.          if(this.enemyValue[_loc2_] > this._maxEnemyValue)
  310.          {
  311.             this.enemyValue[_loc2_] = this._maxEnemyValue;
  312.          }
  313.          this.enemyTimeGap[_loc2_] -= 200;
  314.          if(this.enemyTimeGap[_loc2_] < this._minEnemyTimeGap)
  315.          {
  316.             this.enemyTimeGap[_loc2_] = this._minEnemyTimeGap;
  317.          }
  318.          _loc2_ = _loc2_ + 1;
  319.       }
  320.       this._energyMultiplier -= 2;
  321.    }
  322.    function showHidePowerBars()
  323.    {
  324.       if(this._powerBarsVisible)
  325.       {
  326.          var _loc2_ = 1;
  327.          while(_loc2_ <= this._enemyCounter)
  328.          {
  329.             this["Enemy" + this._enemyCounter].powerbar._visible = false;
  330.             _loc2_ = _loc2_ + 1;
  331.          }
  332.          this._powerBarsVisible = false;
  333.       }
  334.       else
  335.       {
  336.          _loc2_ = 1;
  337.          while(_loc2_ <= this._enemyCounter)
  338.          {
  339.             this["Enemy" + this._enemyCounter].powerbar._visible = true;
  340.             _loc2_ = _loc2_ + 1;
  341.          }
  342.          this._powerBarsVisible = true;
  343.       }
  344.    }
  345.    function startTimer()
  346.    {
  347.       this.intervalID = setInterval(mx.utils.Delegate.create(this,this.timer),100);
  348.    }
  349.    function timer()
  350.    {
  351.       if(this._stopped)
  352.       {
  353.          return undefined;
  354.       }
  355.       this._tCounter = this._tCounter + 1;
  356.       this._gameTimer = this._gameTimer + 1;
  357.       this.interface_mc.addSeconds();
  358.       if(this._tCounter * 100 >= this._enemyTimeGap)
  359.       {
  360.          if(this._enemyCounter <= this._enemyNumber)
  361.          {
  362.             this.attachEnemy();
  363.          }
  364.          this._tCounter = 0;
  365.       }
  366.    }
  367.    function startLevel(nLevel)
  368.    {
  369.       this.setVariables(nLevel);
  370.       this._stopped = false;
  371.       this.attachEnemy();
  372.    }
  373.    function attachEnemy()
  374.    {
  375.       this.attachMovie("Enemy","Enemy" + this._enemyCounter,this.getNextHighestDepth(),{_type:this._enemyType,_value:this._enemyValue});
  376.       this._enemyCounter = this._enemyCounter + 1;
  377.       if(this.currentWeapon != undefined && this.currentWeapon._drag)
  378.       {
  379.          this.currentWeapon.swapDepths(this.getNextHighestDepth());
  380.       }
  381.    }
  382.    function randomizeEnemies(sCurrentEnemy)
  383.    {
  384.       var _loc2_ = undefined;
  385.       _loc2_ = random(this.enemyType.length - 2) + 1;
  386.       while(sCurrentEnemy == this.enemyType[_loc2_])
  387.       {
  388.          _loc2_ = random(this.enemyType.length - 2) + 1;
  389.       }
  390.       this._enemyType = this.enemyType[_loc2_];
  391.    }
  392.    function removeEnemies()
  393.    {
  394.       var _loc2_ = 1;
  395.       while(_loc2_ <= this._enemyCounter)
  396.       {
  397.          this["Enemy" + _loc2_].removeMovieClip();
  398.          _loc2_ = _loc2_ + 1;
  399.       }
  400.    }
  401.    function removeWeapons()
  402.    {
  403.       var _loc2_ = 1;
  404.       while(_loc2_ <= this.w1_counter)
  405.       {
  406.          this["Beans" + _loc2_].removeMovieClip();
  407.          _loc2_ = _loc2_ + 1;
  408.       }
  409.       _loc2_ = 1;
  410.       while(_loc2_ <= this.w2_counter)
  411.       {
  412.          this["Fries" + _loc2_].removeMovieClip();
  413.          _loc2_ = _loc2_ + 1;
  414.       }
  415.       _loc2_ = 1;
  416.       while(_loc2_ <= this.w3_counter)
  417.       {
  418.          this["Pepsi" + _loc2_].removeMovieClip();
  419.          _loc2_ = _loc2_ + 1;
  420.       }
  421.       _loc2_ = 1;
  422.       while(_loc2_ <= this.w4_counter)
  423.       {
  424.          this["Wings" + _loc2_].removeMovieClip();
  425.          _loc2_ = _loc2_ + 1;
  426.       }
  427.       _loc2_ = 1;
  428.       while(_loc2_ <= this.w5_counter)
  429.       {
  430.          this["Burger" + _loc2_].removeMovieClip();
  431.          _loc2_ = _loc2_ + 1;
  432.       }
  433.    }
  434.    function gameOver()
  435.    {
  436.       this.clearWeaponIntervals();
  437.       if(this._draggingWeapon)
  438.       {
  439.          this.currentWeapon.removeMovieClip();
  440.       }
  441.       if(this.interface_mc.wOption != undefined)
  442.       {
  443.          this.interface_mc.wOption.removeMovieClip();
  444.       }
  445.       this._stopped = true;
  446.       clearInterval(this.intervalID);
  447.       if(this._lvl == 48)
  448.       {
  449.          this.finalwd = this.attachMovie("FinalWellDone","FinalWellDone",this.getNextHighestDepth());
  450.          this.finalwd.gotoAndStop("badLuck");
  451.          this.finalwd._x = 350.1;
  452.          this.finalwd._y = 258.15;
  453.          this.finalwd.h.text = this.interface_mc._hours + "h";
  454.          this.finalwd.m.text = this.interface_mc._minutes + "m";
  455.          this.finalwd.s.text = this.interface_mc._seconds + "s";
  456.          this.finalwd.submit_btn.onPress = actionscript.Proxy.create(this,this.enterSubmitDetails);
  457.          this.finalwd.try_again_btn.onPress = actionscript.Proxy.create(this,this.restartGame);
  458.       }
  459.       else
  460.       {
  461.          this.panel_mc = this.attachMovie("Panel","Panel",this.getNextHighestDepth());
  462.          var _loc2_ = undefined;
  463.          var _loc3_ = undefined;
  464.          this.panel_mc.h.text = this.interface_mc._hours + "h";
  465.          this.panel_mc.m.text = this.interface_mc._minutes + "m";
  466.          this.panel_mc.s.text = this.interface_mc._seconds + "s";
  467.          this.panel_mc.try_again_btn.onPress = actionscript.Proxy.create(this,this.restartGame);
  468.          this.panel_mc.submit_btn.onPress = actionscript.Proxy.create(this,this.enterSubmitDetails);
  469.          this.centerMovieClip(this.panel_mc,this);
  470.       }
  471.    }
  472.    function enterSubmitDetails()
  473.    {
  474.       this.panel_mc.removeMovieClip();
  475.       this.finalwd.removeMovieClip();
  476.       this.interface_mc.deleteButtonStates();
  477.       this._parent._parent.gotoAndStop("login");
  478.    }
  479.    function wellDone()
  480.    {
  481.       this.addLevelBonus();
  482.       this.clearWeaponIntervals();
  483.       this._tCounter = 0;
  484.       this._stopped = true;
  485.       clearInterval(this.intervalID);
  486.       if(this._lvl == this._lastLevel)
  487.       {
  488.          this.finalWellDone();
  489.          return undefined;
  490.       }
  491.       if(this._lvl % 6 == 0)
  492.       {
  493.          this.wait(2,"nextLevel");
  494.       }
  495.       else
  496.       {
  497.          this.nextLevel();
  498.       }
  499.    }
  500.    function wait(nSec, fFunc)
  501.    {
  502.       var _loc2_ = new com.mosesSupposes.fuse.Fuse();
  503.       _loc2_.scope = this;
  504.       _loc2_.push({delay:nSec,func:fFunc});
  505.       _loc2_.start();
  506.    }
  507.    function finalWellDone()
  508.    {
  509.       this.finalwd = this.attachMovie("FinalWellDone","FinalWellDone",this.getNextHighestDepth());
  510.       this.finalwd._x = 350.1;
  511.       this.finalwd._y = 258.15;
  512.       this.finalwd.h.text = this.interface_mc._hours + "h";
  513.       this.finalwd.m.text = this.interface_mc._minutes + "m";
  514.       this.finalwd.s.text = this.interface_mc._seconds + "s";
  515.       this.finalwd.submit_btn.onPress = actionscript.Proxy.create(this,this.enterSubmitDetails);
  516.       this.finalwd.try_again_btn.onPress = actionscript.Proxy.create(this,this.restartGame);
  517.    }
  518.    function nextLevel()
  519.    {
  520.       this.panel_mc.removeMovieClip();
  521.       this._lvl = this._lvl + 1;
  522.       this.interface_mc.setText(this.interface_mc.level_txt,this._lvl);
  523.       this.startLevel(this._lvl);
  524.       this.startTimer();
  525.    }
  526.    function restartGame()
  527.    {
  528.       this.triggerTracker();
  529.       this.clearWeaponIntervals();
  530.       clearInterval(this.intervalID);
  531.       this.intervalID = undefined;
  532.       this.panel_mc.removeMovieClip();
  533.       this.finalwd.removeMovieClip();
  534.       this.trail_mc.removeWeaponHitAreas();
  535.       this.removeEnemies();
  536.       this.removeWeapons();
  537.       this.initStartVariables();
  538.       this.initEnemyVariables();
  539.       this.interface_mc.init();
  540.       this.startLevel(this._lvl);
  541.       this.startTimer();
  542.    }
  543.    function centerMovieClip(mTarget_mc, mParent_mc)
  544.    {
  545.       mTarget_mc._x = mParent_mc._width / 2 - mTarget_mc._width / 2;
  546.       mTarget_mc._y = mParent_mc._height / 2 - mTarget_mc._height / 2;
  547.    }
  548.    function clearWeaponIntervals()
  549.    {
  550.       var _loc2_ = 1;
  551.       while(_loc2_ <= this.w1_counter)
  552.       {
  553.          this["Beans" + _loc2_].clearWInterval();
  554.          _loc2_ = _loc2_ + 1;
  555.       }
  556.       _loc2_ = 1;
  557.       while(_loc2_ <= this.w2_counter)
  558.       {
  559.          this["Fries" + _loc2_].clearWInterval();
  560.          _loc2_ = _loc2_ + 1;
  561.       }
  562.       _loc2_ = 1;
  563.       while(_loc2_ <= this.w3_counter)
  564.       {
  565.          this["Pepsi" + _loc2_].clearWInterval();
  566.          _loc2_ = _loc2_ + 1;
  567.       }
  568.       _loc2_ = 1;
  569.       while(_loc2_ <= this.w4_counter)
  570.       {
  571.          this["Wings" + _loc2_].clearWInterval();
  572.          _loc2_ = _loc2_ + 1;
  573.       }
  574.       _loc2_ = 1;
  575.       while(_loc2_ <= this.w5_counter)
  576.       {
  577.          this["Burger" + _loc2_].clearWInterval();
  578.          _loc2_ = _loc2_ + 1;
  579.       }
  580.    }
  581.    function addLevelBonus()
  582.    {
  583.       var _loc2_ = undefined;
  584.       _loc2_ = Math.round((this._enemyNumber + this._enemyValue) / 2);
  585.       this.interface_mc.addSubtractMoney(_loc2_);
  586.    }
  587.    function pauseGame()
  588.    {
  589.       this._stopped = true;
  590.       this._gamePaused = true;
  591.       this.interface_mc.deleteButtonStates();
  592.    }
  593.    function resumeGame()
  594.    {
  595.       this._stopped = false;
  596.       this._gamePaused = false;
  597.       this.interface_mc.initButtonStates();
  598.    }
  599.    function callMenu()
  600.    {
  601.       this.pauseGame();
  602.       this._parent._parent.gotoAndStop("pause");
  603.    }
  604.    function keyUpFunction()
  605.    {
  606.       this._keysLocked = false;
  607.    }
  608.    function triggerTracker()
  609.    {
  610.       this.target_mc = this.createEmptyMovieClip("target_mc",this.getNextHighestDepth());
  611.       var _loc2_ = "http://ts.t-viral.com/1/tracking/link/QAKU4VvJQrR2cQ5E";
  612.       this.target_mc.loadVariables(_loc2_,"get");
  613.    }
  614.    function keyDownFunction()
  615.    {
  616.       var _loc2_ = Key.getCode();
  617.       if(this._keysLocked)
  618.       {
  619.          return undefined;
  620.       }
  621.       if(_loc2_ == 83)
  622.       {
  623.          if(this.currentWeapon != undefined && !this.currentWeapon._drag)
  624.          {
  625.             this.currentWeapon.sellWeapon();
  626.          }
  627.       }
  628.       else if(_loc2_ == 85)
  629.       {
  630.          if(this.currentWeapon != undefined && !this.currentWeapon._drag)
  631.          {
  632.             this.interface_mc.upgrade(this.currentWeapon);
  633.          }
  634.       }
  635.       this._keysLocked = true;
  636.    }
  637.    function addCheats(nKey)
  638.    {
  639.       switch(nKey)
  640.       {
  641.          case 67:
  642.          case 76:
  643.             break;
  644.          case 77:
  645.             this.interface_mc.addSubtractMoney(500);
  646.             break;
  647.          case 78:
  648.             this.interface_mc.addSubtractMoney(-50);
  649.             break;
  650.          case 79:
  651.             this.interface_mc.loseLife();
  652.             break;
  653.          case 38:
  654.             var _loc2_ = 1;
  655.             while(_loc2_ <= this._enemyCounter)
  656.             {
  657.                this["Enemy" + _loc2_]._speed = 5;
  658.                _loc2_ = _loc2_ + 1;
  659.             }
  660.             break;
  661.          case 40:
  662.             _loc2_ = 1;
  663.             while(_loc2_ <= this._enemyCounter)
  664.             {
  665.                this["Enemy" + _loc2_]._speed = this._enemySpeed;
  666.                _loc2_ = _loc2_ + 1;
  667.             }
  668.             break;
  669.          case 80:
  670.             if(!this._gamePaused)
  671.             {
  672.                this.pauseGame();
  673.             }
  674.             else
  675.             {
  676.                this.resumeGame();
  677.             }
  678.       }
  679.    }
  680. }
  681.